package br.com.center.loja;

import java.io.Serializable;

public class SessionCounter implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private Long counter;
	
	private SessionCounter(){
		counter = 0L;
	}
	
	public Long getCounter() {
		return counter;
	}
	
	public void increment(){
		counter++;
	}
	
	public void decrement(){
		counter--;
	}
	
	private static SessionCounter instance;
	
	public static synchronized SessionCounter getInstance(){
		if (instance == null){
			instance = new SessionCounter();
		}
		
		return instance;
	}

}
